<?php

/**
 *
 */
class Controller extends Controller_Core
{
    /**
     * Konstruktor
     */
    public function __construct()
    {
        parent::__construct();
        if (PHP_SAPI == "cli") return;
    }

    /**
     * Redirect
     * @param String $url
     * @param String $title
     * @param String $message
     * @param String $layout
     * @param String $time
     */
    protected function redirect($url = NULL, $title = '', $message = '', $layout = 'layout1', $time = 1)
    {
        if ($url == NULL) $url = request::referrer();
        Session::instance()->set_flash('redirect_url', $url);
        Session::instance()->set_flash('redirect_title', $title);
        Session::instance()->set_flash('redirect_message', $message);
        Session::instance()->set_flash('redirect_layout', $layout);
        Session::instance()->set_flash('redirect_time', $time);
        url::redirect('redirect');
        exit;
    }

     /**
      * Set Session for Redirection
      * @param String $url
      * @param String $title
      * @param String $message
      * @param String $layout
      * @param String $time
      */
    public static function setredirect($url = NULL, $title = '', $message = '', $layout = 'layout1', $time = 1)
    {
        if ($url == NULL) $url = request::referrer();
        Session::instance()->set_flash('redirect_url', $url);
        Session::instance()->set_flash('redirect_title', $title);
        Session::instance()->set_flash('redirect_message', $message);
        Session::instance()->set_flash('redirect_layout', $layout);
        Session::instance()->set_flash('redirect_time', $time);
    }
}
//end of file